Add message template support for alert component#17516
Add message template support for alert component#17516balloob merged 12 commits intohome-assistant:devfrom
Conversation
homeassistant/components/alert.py
Outdated
| if self._message_template is not None: | ||
| message = self._message_template.async_render() | ||
| else: | ||
| message = '{0}'.format(self._name) |
There was a problem hiding this comment.
No reason to format, just message = self._name will do.
|
Looks good! Ok to merge when a test has been added. |
tests/components/test_alert.py
Outdated
| self._setup_notify() | ||
|
|
||
| config = deepcopy(TEST_CONFIG) | ||
| config[alert.DOMAIN][NAME][alert.CONF_MESSAGE_TEMPLATE] = "{{ states.sensor.test.entity_id }}" |
There was a problem hiding this comment.
line too long (102 > 79 characters)
tests/components/test_alert.py
Outdated
There was a problem hiding this comment.
indentation contains tabs
unexpected indentation
TabError: inconsistent use of tabs and spaces in indentation
tests/components/test_alert.py
Outdated
There was a problem hiding this comment.
indentation contains tabs
indentation contains mixed spaces and tabs
blank line contains whitespace
tests/components/test_alert.py
Outdated
There was a problem hiding this comment.
indentation contains mixed spaces and tabs
tests/components/test_alert.py
Outdated
There was a problem hiding this comment.
indentation contains tabs
indentation contains mixed spaces and tabs
blank line contains whitespace
a6634f4 to
b4ad138
Compare
tests/components/test_alert.py
Outdated
homeassistant/components/alert.py
Outdated
There was a problem hiding this comment.
indentation contains mixed spaces and tabs
homeassistant/components/alert.py
Outdated
There was a problem hiding this comment.
blank line contains whitespace
indentation contains mixed spaces and tabs
indentation contains tabs
homeassistant/components/alert.py
Outdated
There was a problem hiding this comment.
blank line contains whitespace
indentation contains mixed spaces and tabs
indentation contains tabs
homeassistant/components/alert.py
Outdated
There was a problem hiding this comment.
continuation line under-indented for visual indent
indentation contains mixed spaces and tabs
indentation contains tabs
homeassistant/components/alert.py
Outdated
homeassistant/components/alert.py
Outdated
There was a problem hiding this comment.
indentation contains mixed spaces and tabs
homeassistant/components/alert.py
Outdated
There was a problem hiding this comment.
continuation line under-indented for visual indent
indentation contains mixed spaces and tabs
indentation contains tabs
homeassistant/components/alert.py
Outdated
homeassistant/components/alert.py
Outdated
This reverts commit 7be519b.
|
I updated the component to support templates for both, message and done_message. For legacy support, the message is optional and the name taken instead, like it was before. |
|
Is this PR clashing with #17616? |
Description:
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#6859
Example entry for
configuration.yaml(if applicable):Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed: